package com.xinzhi.service.impl;

import com.xinzhi.mapper.ChengjiMapper;
import com.xinzhi.pojo.dto.Chengji;
import com.xinzhi.service.ChengjiService;
import com.xinzhi.utils.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
@Service
public class ChengjiServiceImpl implements ChengjiService {

    @Autowired
    private ChengjiMapper chengjiMapper;

    /**
     * 成绩申诉审核根据考评对象查询的接口
     * @param object
     * @return
     */
    @Override
    public List<Chengji> getChengji(String object) {
        return chengjiMapper.getChengji(object);
    }

    /**
     * 成绩申诉审核根据申诉状态查询的接口
     * @param appeal_status
     * @return
     */
    @Override
    public List<Chengji> getChengjiByappeal_status(String appeal_status) {
        return chengjiMapper.getChengjiByappeal_status(appeal_status);
    }


    /**
     * 成绩申诉审核根据年份查询接口
     * @param yearnumber
     * @return
     */
    @Override
    public Result getChengjiByyearnumber(String yearnumber) {
        if (yearnumber == null){
            return Result.error("输入不能为空");
        }
        List<Chengji> chengjiByyearnumber = chengjiMapper.getChengjiByyearnumber(yearnumber);
        return chengjiByyearnumber == null ? Result.error("没有当前年份") : Result.ok(chengjiByyearnumber);
    }
}
